import 'package:flutter/cupertino.dart';
import '../../public.dart';

class MinePage extends StatefulWidget {
  const MinePage({Key? key}) : super(key: key);

  @override
  _MinePageState createState() => _MinePageState();
}

class _MinePageState extends State<MinePage> {
  static jumpApplestore() async {
    if (await canLaunch('https://itunes.apple.com/cn/app/id1561577068')) {
      await launch('https://itunes.apple.com/cn/app/id1561577068');
    } else {
      throw 'url不能进行访问，异常';
    }
  }

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: const CupertinoNavigationBar(
        border: Border(bottom: BorderSide.none),
        middle: Text('SETTING'),
      ),
      child: SafeArea(
        child: Material(
          child: ListView(
            children: [
              GestureDetector(
                onTap: () {
                  RouterHelper.navigator.pushNamed(Routers.feedBack);
                },
                child: Container(
                  height: 44,
                  margin: const EdgeInsets.symmetric(horizontal: 15),
                  child: const Center(child: Text('-FeedBack-')),
                ),
              ),
              // GestureDetector(
              //   onTap: jumpApplestore,
              //   child: Container(
              //     height: 44,
              //     margin: const EdgeInsets.symmetric(horizontal: 15),
              //     child: const Center(
              //       child: Text('-给个评价-'),
              //     ),
              //   ),
              // ),
              GestureDetector(
                onTap: () {
                  RouterHelper.navigator.pushNamed(Routers.about);
                },
                child: Container(
                  height: 44,
                  margin: const EdgeInsets.symmetric(horizontal: 15),
                  child: const Center(child: Text('-About-')),
                ),
              ),
              Padding(
                padding: const EdgeInsets.symmetric(
                  horizontal: 30,
                  vertical: 15,
                ),
                child: TextButton(
                  onPressed: () {
                    StorageManager.clear();
                    RouterHelper.navigator.pushReplacementNamed(Routers.login);
                  },
                  style: ButtonStyle(
                    shape: WidgetStateProperty.all(
                      RoundedRectangleBorder(
                        side: const BorderSide(
                          width: 0.5,
                          color: Color(0xFFB4B4B4),
                        ),
                        borderRadius: BorderRadius.circular(40),
                      ),
                    ),
                    backgroundColor: WidgetStateProperty.all(Colors.amber[900]),
                  ),
                  child: Container(
                    height: 40,
                    alignment: Alignment.center,
                    child: const Text(
                      'Log Out',
                      style: TextStyle(color: Colors.white, fontSize: 16),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
